<template>
  <div class="numa-text">
    <p class="text" v-html="content"></p>
    <span>{{ append }}</span>
  </div>
</template>

<script lang="ts">
import { defineComponent } from 'vue';

export default defineComponent({
  name: 'NumaText',
  props: {
    modelValue: {
      type: [String, Number],
      default: ''
    },
    append: {
      type: String,
      default: ''
    },
    formatter: {
      type: Function,
      default: null
    }
  },
  setup(props) {
    return {
      content: computed(() => (props.formatter ? props.formatter(props.modelValue) : props.modelValue))
    };
  }
});
</script>

<style lang="scss" scoped>
.numa-text {
  width: 100%;
  display: flex;

  .text {
    flex: 1;
  }
}
</style>
